package com.jubaopen.dao.ibatis;

import java.util.List;
import java.util.Map;
import com.jubaopen.bean.AuthInfo;
import com.jubaopen.dao.AuthInfoDAO;

public class AuthInfoDAOImpl extends BaseIBatisDao implements AuthInfoDAO {

	@Override
	public AuthInfo getById(int id) {
		return (AuthInfo) this.getSqlMapClientTemplate().queryForObject(
				"AuthInfoMapper.getById", id);
	}

	@Override
	public AuthInfo getByUserId(int userId) {
		return (AuthInfo) this.getSqlMapClientTemplate().queryForObject(
				"AuthInfoMapper.getByUserId", userId);
	}

	@Override
	public AuthInfo getByLoginName(String loginName) {
		return (AuthInfo) this.getSqlMapClientTemplate().queryForObject(
				"AuthInfoMapper.getByUserId", loginName);
	}

	@Override
	public int add(AuthInfo authInfo) {
		return (Integer) this.getSqlMapClientTemplate().insert(
				"AuthInfoMapper.insert", authInfo);
	}

	@Override
	public int update(AuthInfo authInfo) {
		return this.getSqlMapClientTemplate().update("AuthInfoMapper.update",
				authInfo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<AuthInfo> getPagedList(Map<String, Object> entry) {
		return this.getSqlMapClientTemplate().queryForList(
				"AuthInfoMapper.getPagedList", entry);
	}

	@Override
	public int getCount(Map<String, Object> entry) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(
				"AuthInfoMapper.getCount", entry);
	}

}
